package com.pipe.servicepipe.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pipe.commonutils.PageResult;
import com.pipe.commonutils.R;
import com.pipe.servicepipe.annotation.OperationAnnotation;
import com.pipe.servicepipe.entity.PipeLog;
import com.pipe.servicepipe.entity.vo.PipeLogQuery;
import com.pipe.servicepipe.service.PipeLogService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 日志表 前端控制器
 * </p>
 *
 * @author hetao
 * @since 2020-07-12
 */
@RestController
@RequestMapping("pipe/log")
public class PipeLogController {
    @Resource
    private PipeLogService pipeLogService;

    @PostMapping
    @ApiOperation("查看日志")
    @OperationAnnotation("查看日志")
    public R queryLogByPage(
            @ApiParam(required = false, value = "查询条件")
            @RequestBody PipeLogQuery query) {

        Page<PipeLog> page = new Page<>(query.getPageNum(),query.getPageSize());
        this.pipeLogService.findByPage(query,page);
        PageResult pageResult = new PageResult(page);
        return R.ok().message("查询成功").data("result",pageResult);
    }

}

